package viterbi;


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

import common.Eval;
import common.ViterbiTaggerNew;

public class ViterbiConfMatrix {
	public static void main(String[] args) {
		// Read the pos tags from the training set
		ArrayList<String> pos = new ArrayList<String>();
		try {
			File file = new File("CoNLL2009-ST-English-development-pos.txt");
			BufferedReader br = new BufferedReader(new FileReader(file));
			String line = null;
			while ((line = br.readLine()) != null) {
				if (line.equals(""))
					continue;
				String[] cols = line.split("\t");
				pos.add(cols[4]);
			}
		} catch (IOException x) {
			System.err.format("IOException: %s%n", x);
		}

		// Apply and evaluate the viterbi tagger on the development set
		ArrayList<String> pposViterbi = ViterbiTaggerNew.tag("CoNLL2009-ST-English-development-pos.txt");

		Eval e1 = new Eval(pos, pposViterbi);
		e1.printConfMat();
	}
}
